package test1230pm;

public class Test01 {
    public static void main(String[] args) {
        Test01 t = new Test01();
        t.setA(3);
        t.setB(2);
        int x = t.m1();
        System.out.println(x);
        int y = t.m2();
        System.out.println(y);
        Test01 t1 = new Test01(3,3);
        System.out.println(t1.m1());
        System.out.println(t1.m2());
        // (1)设计一个长方形类
        // 属性：长、宽
        // 功能：周长、面积
        // 要求：分别创建3个不同的对象、求周长、求面积
    }
        int a;
        int b;
    public Test01() {
    }

    public Test01(int a, int b) {
        this.a = a;
        this.b = b;
    }

    public int getA() {
        return a;
    }

    public void setA(int a) {
        this.a = a;
    }

    public int getB() {
        return b;
    }

    public void setB(int b) {
        this.b = b;
    }

    @Override
    public String toString() {
        return "Test01{" +
                "a=" + a +
                ", b=" + b +
                '}';
    }
    public int m1(){
        return (a+b)*2;
    }
    public int m2(){
        return a*b;
    }

}
